<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>天气案例</title>
        <script type="text/javascript" src="../js/vue.js"></script>
        <style>
            button{
                width: 60px;
                height: 40px;
                background-color: aquamarine;
                margin-left: 70px;
            }
        </style>
    </head>

    <body>
        <!-- vue容器 -->
        <div id="root">
            <h1>今天的天气很{{info}},{{x}}</h1>
            <button v-on:click="isHot = !isHot;x++">切换</button>
        </div>

        <script type="text/javascript">
            new Vue({
                el:'#root',
                data:{
                    isHot:true,
                    x:1
                },
                methods:{
                    // changeWeather:function(){
                    //     this.isHot = !this.isHot
                    //     this.x++
                    // }
                },
                computed: {
                    info:function(){
                        return this.isHot?'炎热':'凉爽'
                    }
                }
            })
        </script>
    </body>
</html>